package br.com.gestacard.sync.entidade;


import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.ForeignKey;

import com.powerlogic.jcompany.dominio.valida.PlcValidacaoUnificada;


@MappedSuperclass
@PlcValidacaoUnificada
public abstract class ClienteInstituicao extends AppBaseEntity {

	
	private static final long serialVersionUID = 2400783875091039111L;
	
	
	@Id @GeneratedValue(strategy=GenerationType.AUTO, generator = "SE_CLIENTE_INSTITUICAO")
	@Column (name = "ID_CLIENTE_INSTITUICAO", nullable=false, length=5)
	private Long id;
	
	
	@ManyToOne (targetEntity = ClienteEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name="FK_CLI_INST_CLIENTE")
	@JoinColumn (name = "ID_CLIENTE", nullable=false)
	private Cliente cliente;
	
	
	@ManyToOne (targetEntity = InstituicaoEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name="FK_CLI_INST_INSTITUICAO")
	@JoinColumn (name = "ID_INSTITUICAO", nullable=false)
	private Instituicao instituicao;
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id=id;
	}

	public Cliente getCliente() {
		return cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente=cliente;
	}

	public Instituicao getInstituicao() {
		return instituicao;
	}

	public void setInstituicao(Instituicao instituicao) {
		this.instituicao=instituicao;
	}

}
